/*****************************************************************************
 * $LastChangedDate: 2011-04-23 21:07:07 -0400 (Sat, 23 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   This is an "include template" to avoid duplication in every module's conf.hh.
 * @remarks For a Conf that reads a text conf file.
 * LEGAL:   COPYRIGHT (C) 2011 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

// -- include this inside a module's Conf class that needs to read text conf --

//------------------------------------------------------------------------------
// Private nested class:
//------------------------------------------------------------------------------

    ////////////////////////////////////////////////////////////////////////////
    /// @brief Template Method to parse fields in .conf file.
    ///
    private: class ModuleConfTxt : public base::ConfTxt
    {
        /***********************************************************************
         * Read field.
         ***********************************************************************/
        public: void ProcessField( string& field, std::ifstream& conf );

        /***********************************************************************
         * Optional extra prototypes.
         ***********************************************************************/
#ifdef  CONF_TXT_EXTRA_PROCESS_FIELD_PROTOTYPES
        CONF_TXT_EXTRA_PROCESS_FIELD_PROTOTYPES  // optional
#endif
    };

//------------------------------------------------------------------------------
// Public methods:
//------------------------------------------------------------------------------

    /***************************************************************************
     * ctor.
     ***************************************************************************/
    public: Conf( void );

    /***************************************************************************
     * Initialize/read configuration.
     ***************************************************************************/
    public: void Init( const base::InitArgs& initArgs, const string& confTxtFilename );

//------------------------------------------------------------------------------
// Private methods:
//------------------------------------------------------------------------------

    /***************************************************************************
     * Parse cmdline args (first pass).
     ***************************************************************************/
    private: void ParseCmdlineArgs( int argc, char** argv );

    /***************************************************************************
     * Parse cmdline args (second pass).
     ***************************************************************************/
    private: void ParseCmdlineArgs2( int argc, char** argv );

    /***************************************************************************
     * Read from text conf file.
     * A few modules don't define this (unused prototype ok).
     ***************************************************************************/
    private: void ReadConfTxt( const string& confTxtFilename );

//------------------------------------------------------------------------------
// Data:
//------------------------------------------------------------------------------

    public: bool mValid;     ///< true if Conf was init/read
